// arch/x86_64/boot.asm
[bits 64]
section .text
global _start
_start:
    mov esp, 0xFFFF8000000FF000   ; 设置内核栈
    call kernel_main
    hlt

// kernel/mm/pmm.c
uint64_t *pml4_table = (uint64_t*)0x100000;
void init_paging() {
    // 映射前 2MB 物理内存
    pml4_table[0] = 0x200000 | 0x03;  // Present + RW
    __asm__("mov %0, %%cr3" :: "r"(pml4_table));
    __asm__("mov %%cr0, %0" : "=r"(cr0));
    cr0 |= 0x80000000;  // 启用分页
    __asm__("mov %0, %%cr0" :: "r"(cr0));
}
